/**
 * 
 */
package spitfire.ksim.evaluation;

import javax.swing.SwingUtilities;

import spitfire.ksim.simulation.KSimulation;
import spitfire.ksim.view.KSimulationView;


/**
 * @author Adam
 *
 */
public class KSimApp {

	public static void main(String[] args) {
		final KSimulation simulation = new KSimulation();
		
		if (args.length == 0 || !args[0].equalsIgnoreCase("-nogui")) {
			SwingUtilities.invokeLater(new Runnable() {
				@Override
				public void run() {
					new KSimulationView(simulation);
				}
			});
		}
		
		EvaluationClass eval = new EvaluationClass(simulation);
		eval.loadConfig(args[1]);
		eval.setupScenario();
		eval.runEvaluation();
		
//		eval.addInitNode("nodes/node7.npf", "lecture hall");
//		eval.addInitNode("nodes/node25.npf", "meeting room");
//		eval.addInitNode("nodes/node32.npf", "dining room");
//		
//		eval.addTestNode("nodes/node4.npf", "lecture hall");
//		eval.addTestNode("nodes/node9.npf", "lecture hall");
//		eval.addTestNode("nodes/node10.npf", "lecture hall");
//		
//		eval.addTestNode("nodes/node17.npf", "meeting room");
//		eval.addTestNode("nodes/node19.npf", "meeting room");
//		eval.addTestNode("nodes/node20.npf", "meeting room");
//		eval.addTestNode("nodes/node21.npf", "meeting room");
//		eval.addTestNode("nodes/node22.npf", "meeting room");
//		eval.addTestNode("nodes/node23.npf", "meeting room");
//		eval.addTestNode("nodes/node24.npf", "meeting room");
//		eval.addTestNode("nodes/node26.npf", "meeting room");
//		
//		eval.addTestNode("nodes/node34.npf", "dining room");
//		
//		eval.addInitNode("nodes/singleSensorNode/humid1.spf", "humid");
//		eval.addInitNode("nodes/singleSensorNode/light1.spf", "light");
//		eval.addInitNode("nodes/singleSensorNode/temp1.spf", "temp");
//		eval.addInitNode("nodes/singleSensorNode/volt1.spf", "volt");
//		
//		File file;
//		for (int i = 2; i <= 52; i++) {
//			file = new File("nodes/node" + i + ".spf");
//			if (file.exists()) {
//				eval.addTestNode("nodes/node" + i + ".spf", "humid");
//			}
//		}
//		for (int i = 2; i <= 52; i++) {
//			file = new File("nodes/singleSensorNode/light" + i + ".spf");
//			if (file.exists()) {
//				eval.addTestNode("nodes/singleSensorNode/light" + i + ".spf", "light");
//			}
//		}
//		for (int i = 2; i <= 52; i++) {
//			file = new File("nodes/singleSensorNode/temp" + i + ".spf");
//			if (file.exists()) {
//				eval.addTestNode("nodes/singleSensorNode/temp" + i + ".spf", "temp");
//			}
//		}
//		for (int i = 2; i <= 53; i++) {
//			file = new File("nodes/singleSensorNode/volt" + i + ".spf");
//			if (file.exists()) {
//				eval.addTestNode("nodes/singleSensorNode/volt" + i + ".spf", "volt");
//			}
//		}
//		eval.addTestNode("nodes/singleSensorNode/humid2.spf", "humid");
//		eval.addTestNode("nodes/singleSensorNode/humid21.spf", "humid");
//		eval.addTestNode("nodes/singleSensorNode/humid22.spf", "humid");
//		eval.addTestNode("nodes/singleSensorNode/humid23.spf", "humid");
//		eval.addTestNode("nodes/singleSensorNode/humid24.spf", "humid");
//		eval.addTestNode("nodes/singleSensorNode/humid3.spf", "humid");
//		eval.addTestNode("nodes/singleSensorNode/humid4.spf", "humid");
//		eval.addTestNode("nodes/singleSensorNode/humid6.spf", "humid");
//		
//		eval.addTestNode("nodes/singleSensorNode/light2.spf", "light");
//		eval.addTestNode("nodes/singleSensorNode/light21.spf", "light");
//		eval.addTestNode("nodes/singleSensorNode/light22.spf", "light");
//		eval.addTestNode("nodes/singleSensorNode/light23.spf", "light");
//		eval.addTestNode("nodes/singleSensorNode/light3.spf", "light");
//		eval.addTestNode("nodes/singleSensorNode/light4.spf", "light");
//		
//		eval.addTestNode("nodes/singleSensorNode/temp2.spf", "temp");
//		eval.addTestNode("nodes/singleSensorNode/temp21.spf", "temp");
//		eval.addTestNode("nodes/singleSensorNode/temp22.spf", "temp");
//		eval.addTestNode("nodes/singleSensorNode/temp23.spf", "temp");
//		eval.addTestNode("nodes/singleSensorNode/temp24.spf", "temp");
	}
}
